function chongzhi(id, type) {
	if(type==1){
		var title="余额充值";
	}else{
		var title="积分充值";
	}
	var tel = parent.layer.prompt({
			title: title,
			formType: 0
		},
		function(integral) {
			layer.open({
				content: '确认充值' + integral + '？',
				btn: ['确认', '取消'],
				yes: function(index, layero) {
					var type = "^[0-9]*[1-9][0-9]*$";
					var r = new RegExp(type);
					var flag = r.test(integral);
					if(!flag) {　　
						layer.msg("请输入正确的充值金额");　　
						return false;
					}
					$.ajax({
						type: "post",
						url: "chongzhi",
						data: {
							id: id,
							type: type,
							value: integral
						},
						success: function(data) {
							layer.msg(data.msg);
							if(data.code == 200) {
								var obj = $("#score_" + id);
								obj.text(parseFloat(obj.text()) + parseFloat(integral));
							}
							layer.close(tel);
						}
					});
				},
				btn2: function(index, layero) {},
				cancel: function() {
					//右上角关闭回调  
				}
			});
		});
}
function chongzhi_member(id, type) {
	if(type==2){
		var title="余额充值";
		var obj_id="balance_";
	}else{
		var obj_id="score_";
		var title="积分充值";
	}
	var tel = parent.layer.prompt({
			title: title,
			formType: 0
		},
		function(integral) {
			layer.open({
				content: '确认充值' + integral + '？',
				btn: ['确认', '取消'],
				yes: function(index, layero) {
					var type = "^[0-9]*[1-9][0-9]*$";
					var r = new RegExp(type);
					var flag = r.test(integral);
					if(!flag) {　　
						layer.msg("请输入正确的充值金额");　　
						return false;
					}
					$.ajax({
						type: "post",
						url: "/admin/member/chongzhi_member",
						data: {
							id: id,
							type: type,
							value: integral
						},
						success: function(data) {
							layer.msg(data.msg);
							if(data.code == 200) {
								var obj = $("#"+obj_id + id);
								obj.text(parseFloat(obj.text()) + parseFloat(integral));
							}
							layer.close(tel);
						}
					});
				},
				btn2: function(index, layero) {},
				cancel: function() {
					//右上角关闭回调  
				}
			});
		});
}